import { DialogForm } from 'custom/index'
import { addDataDictionaryDetail, updateDataDictionaryDetail } from '../api'
import BeforeDays from '../components/BeforeDays.vue'

const dictDetailDialog = new DialogForm('DialogForm')

dictDetailDialog
  .title('添加字典内容')
  .getApi(async (_, row) => row)
  .postApi(addDataDictionaryDetail)
  .useGroup('')
    .useItem('val').label('值').required().end()
    .useItem('name').label('名称').required().end()
    .useItem('remark').label('备注')

const dictDetailNewDialog = new DialogForm('DialogForm')

dictDetailNewDialog
  .title('添加字典内容')
  .getApi(async (_, row) => row)
  .postApi(addDataDictionaryDetail)
  .useGroup('')
    .useItem('val').label('值').required().end()
    .useItem('name').label('名称').required().end()
    .useItem('remark').label('备注').end()
    .useCustomItem(BeforeDays, 'beforeDays').label('数据录入日期').required().end()


const editDictDetailDialog = new DialogForm('DialogForm')
editDictDetailDialog
  .title('修改字典内容')
  .getApi(async (_, row) => row)
  .postApi(updateDataDictionaryDetail)
  .useGroup('')
    .useItem('val').label('值').required().end()
    .useItem('name').label('名称').required().end()
    .useItem('remark').label('备注')

const editDictDetailNewDialog = new DialogForm('DialogForm')
editDictDetailNewDialog
  .title('修改字典内容')
  .getApi(async (_, row) => row)
  .postApi(updateDataDictionaryDetail)
  .useGroup('')
    .useItem('val').label('值').required().end()
    .useItem('name').label('名称').required().end()
    .useItem('remark').label('备注').end()
    .useCustomItem(BeforeDays, 'beforeDays').label('数据录入日期').required().end()

export { dictDetailDialog, editDictDetailDialog, dictDetailNewDialog, editDictDetailNewDialog }
